package di.module;

import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

import com.f2prateek.rx.preferences2.RxSharedPreferences;
import com.xgggh.redpack.ui.login.StartUpActivity;

import javax.inject.Singleton;

import app.OkApplication;
import dagger.Module;
import dagger.Provides;
import dagger.android.ContributesAndroidInjector;
import di.scope.ActivityScope;

@Module
public abstract class AppModule {


    @Singleton
    @Provides
    static SharedPreferences providePreferences(OkApplication application) {
        SharedPreferences preferences =
                PreferenceManager.getDefaultSharedPreferences(application);
        return preferences;
    }
    @Singleton
    @Provides
    static RxSharedPreferences provideRxSharedPreferences(SharedPreferences sharedPreferences) {
        return RxSharedPreferences.create(sharedPreferences);
    }


    @Singleton
    @Provides
    static Context provideApplicationContext(Application application) {
        return application;
    }
}